<?php
/**
 * Created by PhpStorm.
 * User: jswei
 * Date: 2018/4/24
 * Time: 8:54
 */

namespace app\admin\model;

use think\Model;

class Setting extends Model{
    protected $pk = 'id';
    protected $table="think_config";
    protected $autoWriteTimestamp = true;

    protected function getStatusAttr($value){
        return $value?true:false;
    }

    protected function setUpdateTimeAttr(){
        return time();
    }

    protected function setCreateTimeAttr(){
        return time();
    }

    /**
     * 获取配置
     * @return array|\PDOStatement|string|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getDetail(){
        return $this->order('id desc')->find();
    }
}